<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="ch-zn">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<head>
    <title>河大喵鉴 </title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/5.1.1/css/bootstrap.min.css">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <style>
        .shotBlogList{
            display: flex;
            flex-wrap: wrap;
            flex-direction: row;
            margin: 20px 0 0 0;
        }
        .shotBlogList > *{
            margin: 30px 10px;
        }
        .row > ul > li{
            text-align: center;
        }
        .row > ul > li:hover{
            background: #169ed8;
        }
        .imgbox > img{
            width: 80%;
            margin: 0 10%;
            height: 180px;
        }
        .description{
            margin: 20px 0 0 0;
            text-indent: 2em;
        }
    </style>
</head>

<body>

<div class="row">
    <jsp:include page="leftbar.jsp"/>
    <div class="col-10">
        <jsp:include page="headbar.jsp"/>
        <div class="shotBlogList col-12">
            <c:choose>
                <c:when test="${shotBlogList!=null}">
                    <c:forEach items="${shotBlogList}" var="shotBlog">
                        <div class="col-3" onclick="toDetails(${shotBlog.blogId})">
                            <div class="imgbox col-12">
                                <c:if test="${shotBlog.images.size()>0}">
                                    <img src="${pageContext.request.contextPath}/img_res/${shotBlog.images.get(0).path}" alt="id: ${shotBlog.blogId}没有图片">
                                </c:if>
                                <c:if test="${shotBlog.images.size()==0}">
                                    <img src="${pageContext.request.contextPath}/img/cat1.jpg" alt="">
                                </c:if>
                            </div>
                            <div class="description">${shotBlog.content}</div>
                        </div>
                    </c:forEach>
                </c:when>
                <c:otherwise>
                    随拍列表为空
                </c:otherwise>
            </c:choose>
        </div>
        <c:if test="${shotBlogList.size()<=3}">
            <div style="height: 300px" class="col-12">

            </div>
        </c:if>
        <ul class="pagination">
            <li class="page-item"><a class="page-link" href="${pageContext.request.contextPath}/open/shotBlogs?pageNumber=-2">Previous</a></li>
            <c:forEach items="${pages}" var="page">
                <li class="page-item"><a class="page-link" href="${pageContext.request.contextPath}/open/shotBlogs?pageNumber=${page}">${page}</a></li>
            </c:forEach>
            <li class="page-item"><a class="page-link" href="${pageContext.request.contextPath}/open/shotBlogs?pageNumber=-1">Next</a></li>
        </ul>
    </div>
</div>
<script>
    function toDetails(id) {
        $(location).attr("href",'${pageContext.request.contextPath}/open/shotBlog/'+id)
    }
</script>
</body>

</html>